$(document).ready(function() {
    queryTeacher();
});

var queryTeacher=function () {
    $.ajax({
        url: "http://localhost:8080/teacher/queryTeacher",
        type: "GET",
        async: true,
        data: "teNum=" + 1011,
        dataType: "json",
        success: function (data) {
            //console.log(data);
            //console.log(data.data);
            console.log(data.data.teacher);
            //console.log(data.data.teacher.teNum);
            console.log(data.data.teacher.teName);
            console.log(data.data.teacher.tePoli);

             var teacher=data.data.teacher;
            $("#teName").html(teacher.teName);
            $("#teNum").html(teacher.teNum);
            if (teacher.teSex==0) {
                $("#teSex").html("男");
            }else {
                $("#teSex").html("女");
            }
            $("#teNation").html(teacher.teNation);
            $("#teNativeplace").html(teacher.teNativeplace);
            $("#teBirthday").html(teacher.teBirthday);
            $("#teIdcardNum").html(teacher.teIdcardNum);

            if (teacher.tePoli==0){
                $("#tePoli").html("群众");
            }else if (teacher.tePoli==1) {
                $("#tePoli").html("积极分子");
            }else if (teacher.tePoli==2) {
                $("#tePoli").html("发展对象");
            }else if (teacher.tePoli==3) {
                $("#tePoli").html("中共预备党员");
            }else{
                $("#tePoli").html("中共党员");
            }

            $("#tePhone").html(teacher.tePhone);

        },
        error:function () {
            layer.msg("网络在开小差~稍后重试");
        }
    });
}

$(document).on('click', '#updatePerson', function () {
    //获取$teNum
    var $teNum = 1011;
    //页面层
    layer.open({
        type: 2,
        title: '修改身份信息',
        area: ['800px', '800px'],
        content: ['personUpdate.html?teNum='+$teNum, 'no']
    })
})